<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>表单添加编辑渲染</title>
        <{$showjs}>
        <link rel="stylesheet" type="text/css" href="/Plug-in/ext/resources/css/xtheme-slate.css" />
        <link rel="stylesheet" type="text/css" href="../css/main.css" />
        <{section name=li loop=$plugcss}>
        <link rel="stylesheet" type="text/css" href="<{$plugcss[li]}>" />
        <{/section}>
        <{section name=li loop=$plugurl}>
        <script type="text/javascript" src="<{$plugurl[li]}>"></script>
        <{/section}>
        <script type="text/javascript" src="/Plug-in/My97/WdatePicker.js"></script>
        <script type="text/javascript" src="/Plug-in/My97/WdatePicker.js"></script>
        <script type="text/javascript" src="/Plug-in/ext/colorpicker/colorpicker.js"></script>
        <script type="text/javascript" src="/Plug-in/ext/colorpicker/colorpickerfield.js"></script>
        <link rel="stylesheet" type="text/css" href="/Plug-in/ext/colorpicker/colorpicker.css" />
        <style type="text/css">
            .x-date-menu > ul{
                display: inline;
            }
            .x-date-menu > ul li{
                display: inline;
            }
            .hang {
                background:#EEEEEF;
                border-top:1px dotted #B5B8C8;
                border-bottom:1px dotted #B5B8C8;
            }

        </style>
        <script language="javascript">
            Ext.onReady(function(){
                Ext.QuickTips.init();
                Ext.form.Field.prototype.msgTarget = 'qtip';
                var form = new Ext.form.FormPanel({
                    renderTo:Ext.getBody(),
                    bodyStyle:'padding:5px;background:#A2B3CC',
                    labelWidth:100,
                    border:false,
                    autoScroll:true,
                    fileUpload: true, 
                    labelAlign:'right',
                    buttunAlign:'left',
                    plain:true,
                    frame:true,
                    items:[{
                            xtype:'fieldset',
                            title: '<{$action}>',
                            autoHeight:true,
                            bodyStyle:'padding:10px;',
                            layout:'form',
                            items:[
                                {
                                    xtype:'hidden',
                                    name: 'id',
                                    id:'id',
                                    value:'<{$id}>'
                                },{
                                    xtype:'hidden',
                                    name: 'tid',
                                    value:'<{$tid}>'
                                },{
                                    xtype:'hidden',
                                    name: 'bdtid',
                                    value:'<{$bdtid}>'
                                },{
                                    xtype:'hidden',
                                    name: 'bdid',
                                    value:'<{$bdid}>'
                                },{
                                    xtype:'hidden',
                                    name: 'gid',
                                    value:'<{$gid}>'
                                },{
                                    xtype:'hidden',
                                    name: 'lg',
                                    value:'<{$lg}>'
                                },
                                    <{section name=li loop=$js}>
                                    <{$js[li]}>
                                    <{if $smarty.section.li.index+1 < $js|@count}>,<{/if}><{/section}>
                                ]
                        }],
                    buttons: [{
                            xtype:'button',
                            text: '保存',
                            handler:function (){
                                if(form.form.isValid()){
                                        <{$fckplugin}>
                                        form.form.doAction('submit',{
                                        url:'i.php',
                                        method:'POST',
                                        params:{op:'save'},
                                        waitMsg:'正在提交....',
                                        success:function(form,action){
                                            if (action.result.msg=='ok') {
                                                Ext.Msg.confirm('提示','成功!是否关闭本窗口?',function(a){
                                                    if(a=='yes'){
                                                        parent.gridrefresh();
                                                        parent.Ext.getCmp('adddata<{$tid}>').close();
                                                    }
                                                });

                                            } else {
                                                Ext.Msg.alert('提示',unescape(action.result.msg));
                                            }
                                        }
                                        ,
                                        //提交失败的回调函数
                                        failure:function(){
                                            Ext.Msg.alert('错误','数据提交错误！');
                                        }
                                    })};
                            }
                        },{
                            xtype:'button',
                            text: '重置',
                            handler:function (){	
                                form.form.reset();
                            }
                        }],
                    listeners:{
                        render :function(){
                            <{php}>
                            $plugin = Plugin::init();
                            $plugin -> trigger('mb_show1_add_render',$save);
                            <{/php}>
                        }
                    }


                });
                    <{section name=li loop=$plugjs}>
                    <{$plugjs[li]}>
                    <{/section}>
                });

            /**
            清空附件函数
             */
            function qkzd(id,zd){
                Ext.Msg.confirm('提示','你真的要清空此附件？',function(a){
                    if(a=='yes'){				
                        Ext.Ajax.request({
                            waitMsg:'数据处理中...',
                            url:'./i.php',
                            method:'POST',
                            params:{
                                op:'qkzd',
                                id:id,
                                tname:'<{$tname}>',
                                zd:zd
                            },
                            success:function(response){
                                Ext.get('annex-'+zd).remove();
                                //window.location.reload();
                            },
                            failure:function(response){
                                Ext.MessageBox.alert('警告',"无法连接数据库!");
                            }
		
                        });
                    }
                });
            }
        </script>
    </head>
    <body>
    </body>
</html>